﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Pong
{

    public struct Vector2D
    {
        public double X;
        public double Y;

        public Vector2D(double X, double Y)
        {
            this.X = X;
            this.Y = Y;
        }
        public double CrossProduct(Vector2D v)
        {
            return this.X * v.Y - this.Y * v.X;
        }
    }

    public class Pawn
    {

        //public Vector2D Position { get; set; }
        public Vector2D Velocity;
        public Vector2D Acceleration;

        public Double X
        {
            get { return this.TranslateTransform.X; }
            set { this.TranslateTransform.X = value; }
        }

        public Double Y
        {
            get { return this.TranslateTransform.Y; }
            set { this.TranslateTransform.Y = value; }
        }

        public Shape PawnDisplayer { get; private set; }
        public TranslateTransform TranslateTransform 
        { 
            get  
            {                
                return (TranslateTransform)this.PawnDisplayer.RenderTransform;
            }
        }

        public Pawn(Shape shape, TranslateTransform transform)
        {
            this.PawnDisplayer = shape;            
            this.PawnDisplayer.RenderTransform = transform;
        }

        public Pawn(Shape shape) : this(shape, new TranslateTransform())
        {
        }

        public void SetPosition(Double x, Double y)
        {
            this.TranslateTransform.X = x;
            this.TranslateTransform.Y = y;
        }

        
    }
}
